package com.gmq.mianshi.designModel.singleton;

/**
 * @author gmq
 * @email 2628931@qq.com
 * @date 2017/11/23 11:14
 */
public class TMain {

    public static void main(String[] args){
        TestSingleton ts1 = TestSingleton.getInstance();
        ts1.setName("jason");
        TestSingleton ts2 = TestSingleton.getInstance();
        ts2.setName("0539");

        ts1.printInfo();
        ts2.printInfo();

        if(ts1 == ts2){
            System.out.println("创建的是同一个实例");
        }else{
            System.out.println("创建的不是同一个实例");
        }


        Integer s1 = new Integer("-128");
        Integer s2 = new Integer("-128");
        Integer s3 = new Integer("128");
        Integer s4 = new Integer("128");
        System.out.println(s1 == s2);
        System.out.println(s3 == s4);
    }
}
